<?php

/* * 
 * 资讯
 */
namespace Common\Model;
use Think\Model;
class PaymentModel extends BaseModel {

    public function queryForList($page=null, $map=null) {
        $list = $this->alias("pm")
            ->join("left join __CUSTOMER__ cus on cus.customer_id = pm.customer_id")
            ->join("left join __PAY__ pay on pay.pay_id = pm.pay_id")
            ->where(getWhereSqlByMap($map))
            ->order("pm.create_time desc")
            ->limit($page->firstRow . ',' . $page->listRows)
            ->field("pm.*,cus.nickname,cus.realname,pay.out_trade_no")
            ->select();

        return $list;

    }

    public function getListCount($map = null) {

        $count = $this->alias("pm")
            ->join("left join __CUSTOMER__ cus on cus.customer_id = pm.customer_id")
            ->where(getWhereSqlByMap($map))
            ->count();

        return $count;
    }

}

